﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using NClass.AssemblyImport;
using NClass.TestHelper;
using NReflect.NREntities;
using NReflect.NRMembers;
using System;

namespace NClass.Test.AssemblyImport
{
	[TestClass]
	public class NClassImportFilterTest
	{
		[TestMethod]
		[TestCategoryAttribute("Code Analysis")]
		public void NullParameterValidation()
		{
			NClassImportFilter nclassFilter = null;

			try
			{
				nclassFilter = new NClassImportFilter(null);
			}
			catch (ArgumentNullException)
			{
				// NULL Parameter was validated
				nclassFilter = new NClassImportFilter(new TestFilter());
				return;
			}

			string errorMessage = string.Empty;

			Assert.AreEqual(MethodValidator.Result.Succeeded,
				MethodValidator.CheckParameterValidation<NClassImportFilter>(() => { nclassFilter.Reflect((NRClass)null); },
				"Reflect(NRClass)", "NClassImportFilterTest", "NullParameterValidation", out errorMessage),
				errorMessage);

			Assert.AreEqual(MethodValidator.Result.Succeeded,
				MethodValidator.CheckParameterValidation<NClassImportFilter>(() => { nclassFilter.Reflect((NRConstructor)null); },
				"Reflect(NRConstructor)", "NClassImportFilterTest", "NullParameterValidation", out errorMessage),
				errorMessage);

			Assert.AreEqual(MethodValidator.Result.Succeeded,
				MethodValidator.CheckParameterValidation<NClassImportFilter>(() => { nclassFilter.Reflect((NRDelegate)null); },
				"Reflect(NRDelegate)", "NClassImportFilterTest", "NullParameterValidation", out errorMessage),
				errorMessage);

			Assert.AreEqual(MethodValidator.Result.Succeeded,
				MethodValidator.CheckParameterValidation<NClassImportFilter>(() => { nclassFilter.Reflect((NREnum)null); },
				"Reflect(NREnum)", "NClassImportFilterTest", "NullParameterValidation", out errorMessage),
				errorMessage);

			Assert.AreEqual(MethodValidator.Result.Succeeded,
				MethodValidator.CheckParameterValidation<NClassImportFilter>(() => { nclassFilter.Reflect((NREnumValue)null); },
				"Reflect(NREnumValue)", "NClassImportFilterTest", "NullParameterValidation", out errorMessage),
				errorMessage);

			Assert.AreEqual(MethodValidator.Result.Succeeded,
				MethodValidator.CheckParameterValidation<NClassImportFilter>(() => { nclassFilter.Reflect((NREvent)null); },
				"Reflect(NREvent)", "NClassImportFilterTest", "NullParameterValidation", out errorMessage),
				errorMessage);

			Assert.AreEqual(MethodValidator.Result.Succeeded,
				MethodValidator.CheckParameterValidation<NClassImportFilter>(() => { nclassFilter.Reflect((NRField)null); },
				"Reflect(NRField)", "NClassImportFilterTest", "NullParameterValidation", out errorMessage),
				errorMessage);

			Assert.AreEqual(MethodValidator.Result.Succeeded,
				MethodValidator.CheckParameterValidation<NClassImportFilter>(() => { nclassFilter.Reflect((NRInterface)null); },
				"Reflect(NRInterface)", "NClassImportFilterTest", "NullParameterValidation", out errorMessage),
				errorMessage);

			Assert.AreEqual(MethodValidator.Result.Succeeded,
				MethodValidator.CheckParameterValidation<NClassImportFilter>(() => { nclassFilter.Reflect((NRMethod)null); },
				"Reflect(NRMethod)", "NClassImportFilterTest", "NullParameterValidation", out errorMessage),
				errorMessage);

			Assert.AreEqual(MethodValidator.Result.Succeeded,
				MethodValidator.CheckParameterValidation<NClassImportFilter>(() => { nclassFilter.Reflect((NROperator)null); },
				"Reflect(NROperator)", "NClassImportFilterTest", "NullParameterValidation", out errorMessage),
				errorMessage);

			Assert.AreEqual(MethodValidator.Result.Succeeded,
				MethodValidator.CheckParameterValidation<NClassImportFilter>(() => { nclassFilter.Reflect((NRProperty)null); },
				"Reflect(NRProperty)", "NClassImportFilterTest", "NullParameterValidation", out errorMessage),
				errorMessage);

			Assert.AreEqual(MethodValidator.Result.Succeeded,
				MethodValidator.CheckParameterValidation<NClassImportFilter>(() => { nclassFilter.Reflect((NRStruct)null); },
				"Reflect(NRStruct)", "NClassImportFilterTest", "NullParameterValidation", out errorMessage),
				errorMessage);
		}
	}
}
